<?php require __DIR__.'/header.html';?>
<main class="packages-list-container" id="all-packages">
    <div class="container">
        <div class="list-group packages" id="common-packages">
            <!--<a href="https://www.bt.cn/?invite_code=MV9udmV5a2o=" target="_blank" rel="nofollow"
  title="宝塔服务器面板 - 简单好用的Linux/Windows服务器运维管理面板"><img width="100%"
src="https://tva3.sinaimg.cn/large/0080xEK2ly1gdyk82zp31j30kx028mx7.jpg"></a>
<hr>-->

            <?php if(!empty($list)):
        foreach($list as $k=>$v):?>

            <div class="package list-group-item" style="padding: 30px 20px 10px 50px;">
                <a alt="<?php echo $v['l_title'];?>" href="/doc/<?php echo $v['l_alias'];?>.html"
                    style="color: #292b2e;" target="_blank">
                    <div class="row">
                        <div class="col-md-3">
                            <h4 class="package-name">
                                <?php echo $v['l_title'];?>
                            </h4>
                        </div>
                        <div class="col-md-9 hidden-xs">
                            <p class="package-description">
                                <?php echo $v['l_desc'];?>
                            </p>
                            <div class="package-extra-info col-md-9 col-md-offset-3 col-xs-12">
                                <i class="fa fa-star"></i>
                                <?php echo $v['l_count'];?></span>
                            </div>
                        </div>
                    </div>
                </a>
            </div>

            <?php endforeach;
                    endif;?>

        </div>

    </div>

    <?php require __DIR__.'/extra.html';?>


    <?php require __DIR__.'/footer.html';?>




    <script src="/assets/default/js/jquery.min.js" type="text/javascript"></script>
    <script src="/assets/default/js/jquery.min.js" type="text/javascript"></script>
    <script src="/assets/layui/layui.all.js"></script>

    <script>

        var screenWid = window.screen.width;//屏幕宽度
        if (screenWid > 480) screenWid = '480px';//设置弹窗最大宽度
        /*建站时间计算*/
        function show_date_time(t) {
            window.setTimeout("show_date_time()", 1000);
            BirthDay = new Date(t);
            today = new Date();
            timeold = (today.getTime() - BirthDay.getTime());
            sectimeold = timeold / 1000;
            secondsold = Math.floor(sectimeold);
            msPerDay = 24 * 60 * 60 * 1000;
            e_daysold = timeold / msPerDay;
            daysold = Math.floor(e_daysold);
            e_hrsold = (e_daysold - daysold) * 24;
            return daysold;
        }

        $("#y-day").html(show_date_time(web_time));

        //<?php if($web['gg']):?>
        /*公告弹窗*/
        layui.use('layer', function () {
            const $ = layui.jquery, layer = layui.layer;
            window.onload = function () {
                const s = document.cookie;
                if (s.indexOf('notice=1') !== -1) return;
                const d = new Date();
                d.setHours(d.getHours() + 24);
                document.cookie = 'notice=1;expires=' + d.toGMTString();
                popnotice();
            }
            window.popnotice = function popnotice() {
                layer.open({
                    type: 1,
                    title: '<strong>公告</strong>',//公告标题
                    closeBtn: false, //不显示标题栏
                    area: screenWid,//提示窗宽度
                    shade: 0.8,//透明度
                    id: 'Mainnotice', //设定一个id，防止重复弹出
                    btn: ['我要赞助', '我晓得了'],//按钮
                    btnAlign: 'c',//按钮对齐方式
                    moveType: 1, //拖拽模式，0或1
                    /*padding:弹窗两侧边距 line-height:行距*/
                    content: `<div style="padding: 30px; line-height: 24px; background-color: #393D49; color: #fff; font-weight: 300; font-size: 16px;"><p style="text-indent: 2em;"><?php echo $web["gg"];?></div>`,
                    success: function (layero) {
                        var btn = layero.find('.layui-layer-btn');
                        btn.find('.layui-layer-btn0').attr({
                            href: '/api/about'//跳转地址
                            , target: '_blank'//跳转方式
                        });
                    }
                });
            }
            $('#layerDemo .layui-btn').on('click', function () {
                var othis = $(this), method = othis.data('method');
                active[method] ? active[method].call(this, othis) : '';
            });
        });
        // <?php endif;?>



        /*收藏页面*/
        function AddFavorite(sURL, sTitle) {
            sURL = encodeURI(sURL);
            try {
                window.external.addFavorite(sURL, sTitle)
            } catch (e) {
                try {
                    window.sidebar.addPanel(sTitle, sURL, "")
                } catch (e) {
                    alert("加入收藏失败,请使用Ctrl+D进行添加！")
                }
            }
        }

        jQuery(document).ready(function () {
            const QRBox = $('#QRBox');
            const MainBox = $('#MainBox');

            function showQR(QR) {
                const url = 'url(' + QR + ') no-repeat #fff';
                console.log(url);
                MainBox.css('background', url);
                MainBox.css('background-size', "contain");
                $('#donateBox').addClass('blur');
                QRBox.fadeIn(300, function (argument) {
                    MainBox.addClass('showQR');
                });
            }

            $('#donateBox>li').click(function (event) {
                const thisID = $(this).attr('id');
                if (thisID === 'QQ') {
                    showQR("<?php echo $web['url1'];?>");
                } else if (thisID === 'AliPay') {
                    showQR("<?php echo $web['url2'];?>");
                } else if (thisID === 'WeChat') {
                    showQR('-25px -160px');
                }
            });

            MainBox.click(function (event) {
                MainBox.removeClass('showQR').addClass('hideQR');
                setTimeout(function (a) {
                    QRBox.fadeOut(300, function (argument) {
                        MainBox.removeClass('hideQR');
                    });
                    $('#donateBox').removeClass('blur');
                }, 600);
            });
        });
        $("#search").bind('input propertychange', function () {
            const txt = $('#search').val();
            if ($.trim(txt) != '') {
                let data = $(".list-group-item");
                for (value in data) {
                    if (!isNaN(parseFloat(value)) && isFinite(value)) {
                        const obj = $(data[value]);
                        $(obj).hide();
                        $(obj).filter(":contains(" + txt + ")").show();
                    }
                }
            } else {
                $('.list-group-item').show();
            }
        });


        jQuery.noConflict();
        //body = jQuery('body').prepend('<canvas style="position: fixed;z-index: -1;overflow: hidden;"></canvas>');
    </script>
    </body>

    </html>